get last character of string c#

46

get last 4 character c# -

string mystring = "Hellopeople";
string lastFour =  mystring.Substring(mystring.Length - 4 , 4);

Console.WriteLine(lastFour);

c# get last character of string -

mystring.Substring(mystring.Length - 4);

Comments

Submit
0 Comments